<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('公司主数据')"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: select2-css"/>
</head>
<style>
    select {
        padding-top: 3px !important;
    }

    .select-list {
        margin-top: 5px !important;
    }
</style>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="company-form">
                <div class="col-sm-12">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>公司编号：</p>
                                <input type="text" name="compCode" class="form-control">
                            </li>
                            <li>
                                <p>公司名称：</p>
                                <input type="text" name="compName" class="form-control">
                            </li>
                            <li>
                                <p>所属集团：</p>
                                <input type="text" name="compGroup" class="form-control">
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </div>
            </form>
        </div>
        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()">
                <i class="fa fa-plus"></i> 新增
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()">
                <i class="fa fa-edit"></i> 修改
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: echarts-js"/>
<script th:inline="javascript">
    var prefix = ctx + "company";

    $(function () {
        var options = {
            uniqueId: "id",
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            modalName: "公司",
            columns: [{
                checkbox: true
            },
                {
                    field: 'compCode',
                    title: '公司编码'
                },
                {
                    field: 'compName',
                    title: '公司名称'
                },
                {
                    field: 'compAbbr',
                    title: '公司简称'
                },
                {
                    field: 'parentName',
                    title: '上级公司'
                },
                {
                    field: 'compGroup',
                    title: '所属集团'
                },
                {
                    field: 'createTime',
                    title: '创建时间'
                },
                {
                    field: 'updateTime',
                    title: '更新时间'
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter: function (value, item, index) {
                        if (item.status == '0') {
                            return '<span class="label label-primary">启用</span>';
                        }
                        else if (item.status == '1') {
                            return '<span class="label label-danger">停用</span>';
                        }
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>